package com.example.test.Service.Impl;

import com.example.test.DAO.BaseDAO;
import com.example.test.Service.BaseService;
import com.example.test.Service.UserService;
import com.example.test.DAO.UserDAO;
import com.example.test.DAO.impl.UserDAOImpl;
import com.example.test.bean.User;
import com.example.test.controller.UserController;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl extends BaseService implements UserService {
    @Autowired
    protected UserDAO userDAO;
    @Override
    public void registUser(User user) {
        userDAO.insert(user);
    }
    @Override
    public User login(User user) {
        return userDAO.queryUser(user.getUsername(),user.getPassword());
    }
    @Override
    public void deleteUser(String username) {
        userDAO.deleteUser(username);
    }
    @Override
    public String UserIsExists(String username) {
        if(userDAO.queryUserName(username)==null){
            return "false";
        }
        return "true";
    }
}
